<script>
var _lotto_id = {lotto_id};
var globalvar = {};
var _rateArrAll = "";
globalvar.chkOKflag = false; // 是否可送出
// 表格
$(function(){
  
  $("span#spanChgBetBtn").hide();
  
  // 取消 submit的检查
  $("form").unbind("submit");

  $().getRCMPdata(_lotto_id,_gametype);
  
  // 切换赔率
  $("select#slcDisk").change(function(){
    $("input:reset").click();
    $("input#disk").attr("value",$("select#slcDisk option:selected").val());
    $().getRCMPdata(_lotto_id,_gametype);
  });

  // 勾选
  $(".betnum").bind("click",function(){ //tr>td>input:checkbox
    var o=$(this).find("input");
		if(o.attr("checked",o.attr("checked")==false))
		o.showChkMsg();
  });
  
  // 表单
  $('form').submit(function() {
     var moneyNum = $("input:text#setMomney").val();
     if(globalvar.chkOKflag == false){
        $().showMyMsgBox("勾选资料不齐全，无法下注");
        return false;
     }else if(moneyNum == "" || (moneyNum != parseInt(moneyNum)) || moneyNum < 1){
        $().showMyMsgBox("请输入每单笔的金额！限数字。");
        $("input:text#setMomney").focus();
        return false;
     }else if(moneyNum < _betmin){
        $().showMyMsgBox("下注金额不能少於最低下注额("+_betmin+"元)！");
        $("input:text#setMomney").focus();
        return false;
     }else {
        $("input#disk").attr("value",$("select#slcDisk option:selected").val());
        return true;
     }
  });
 
  // 取消颜色变化
  $("input:reset").click(function(){
    $("table#tblNowBet tr").children().css("background-color","");
    $("span[id^=chkmsg]").text("");
  });
  	//路途
  $(".disClc").bind("click",function(b){
		var row=$(this).attr("tag");
		$("#lt_table tr[class='td2']").hide();
		$(".onClc").removeClass("onClc");
		$(this).addClass("onClc");
		$("#lt_tr_"+row).show();
	});

});


// 勾选号码时的动作 因使用中文字而放置於此
$.fn.showChkMsg = function(){
  globalvar.chkOKflag = false;
  var rateStr = "";
  if($(this).attr("checked") == true){
   $(this).parent().parent().children().css("background-color","#33C0BB");
  }else{
    $(this).parent().parent().children().css("background-color","");
  }
  var chktype = $(this).attr("name").substr(4,1);
  var tempStr = "";
  var sizeStr = $("tr>td>input:checkbox[name^='rcmp"+chktype+"']:checked").size();
  var sizeStr3 = $("tr>td>input:checkbox[name^='rcmp3']:checked").size();
  var sizeStr2 = $("tr>td>input:checkbox[name^='rcmp2']:checked").size();
  var sizeStr1 = $("tr>td>input:checkbox[name^='rcmp1']:checked").size();
  
  var pName = new Array();
  pName[3] = "佰";               
  pName[2] = "拾";
  pName[1] = "个";
  if(sizeStr == 0){
    tempStr = "";
  }else {
    tempStr = "[" + pName[chktype] + "位数] 已选了<font class=red>" + sizeStr + "</font>个号码：<br />";
  }
  $("span#chkmsg"+chktype).html(tempStr);
  var strApp = "";
  if(sizeStr3 < 1){strApp += "[佰位数] <font class=red>请至少选一码</font><br />";}
  if(sizeStr2 < 1){strApp += "[拾位数] <font class=red>请至少选一码</font><br />";}
  if(sizeStr1 < 1){strApp += "[个位数] <font class=red>请至少选一码</font><br />";}
  
  var sizeTotal = sizeStr1 + sizeStr2 + sizeStr3;
  var chkOKflag = false;
  if(sizeTotal < 9){strApp += "总共选了<font class=red>"+sizeTotal+"</font>码，<font class=red>请再勾选"+ (9-sizeTotal) +"码</font><br />";}
  else if(sizeTotal > 21){strApp = "总共选了"+sizeTotal+"码，请取消<font class=red>"+ (sizeTotal-21) +"</font>码";}
  else if(sizeStr1 > 0 && sizeStr2 > 0 && sizeStr3 >0){ 
    strApp = "总共选了"+sizeTotal+"码，形成<font class=red>"+sizeStr3+"x"+sizeStr2+"x"+sizeStr1+"</font>组合<br />";
    // 计算赔率
    rateStr = $().getRateRCMP($("tr>td>input:checkbox[name^='rcmp3']:checked"),$("tr>td>input:checkbox[name^='rcmp2']:checked"),$("tr>td>input:checkbox[name^='rcmp1']:checked"));
    strApp += "赔率为:<b class=rate_th2>"+rateStr+"</b><br />";
    globalvar.chkOKflag = true;
  }
  else{strApp += "总共选了<font class=red>"+sizeTotal+"</font>码<br />";}
  $("span#chkmsg").html(strApp);
};


</script>
<div id="errormsg"></div>
<div id="mainPageData">
<form action="{action}" method="post" style="margin-top:0">
<input type="hidden" value="" name="disk" id="disk" />
<table class="table_3d" cellpadding="0" cellspacing="1" width="500"  id="tblNowBet" >
<caption class="title0 bgImg_{gametype}" style="font-size:16px;">复式组合</caption>
<thead>
<tr class="bgClc_{gametype}">
<th>佰位数</th>
<th>拾位数</th>
<th>个位数</th>
</tr>
</thead>
<tr style="padding:0;">
<td>
    <table class="tblMy3D" width="100%">
    <thead>
    <tr class="td15">
    <th>号码</th>
    <th>选择</th>
    </tr>
    </thead>
    <tbody id="tbdrcmp3">
    <tr class="td2"><th class="title02_3d">0</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp3[]" value="0" /></td></tr>
    <tr class="td2"><th class="title02_3d">1</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp3[]" value="1" /></td></tr>
    <tr class="td2"><th class="title02_3d">2</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp3[]" value="2" /></td></tr>
    <tr class="td2"><th class="title02_3d">3</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp3[]" value="3" /></td></tr>
    <tr class="td2"><th class="title02_3d">4</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp3[]" value="4" /></td></tr>
    <tr class="td2"><th class="title02_3d">5</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp3[]" value="5" /></td></tr>
    <tr class="td2"><th class="title02_3d">6</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp3[]" value="6" /></td></tr>
    <tr class="td2"><th class="title02_3d">7</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp3[]" value="7" /></td></tr>
    <tr class="td2"><th class="title02_3d">8</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp3[]" value="8" /></td></tr>
    <tr class="td2"><th class="title02_3d">9</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp3[]" value="9" /></td></tr>
    </tbody>
    </table>
</td>
<td>
    <table class="tblMy3D" width="100%">
    <thead>
    <tr class="td15">
    <th>号码</th>
    <th>选择</th>
    </tr>
    </thead>
    <tbody id="tbdcmp2"> 
    <tr class="td2"><th class="title02_3d">0</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp2[]" value="0" /></td></tr>
    <tr class="td2"><th class="title02_3d">1</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp2[]" value="1" /></td></tr>
    <tr class="td2"><th class="title02_3d">2</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp2[]" value="2" /></td></tr>
    <tr class="td2"><th class="title02_3d">3</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp2[]" value="3" /></td></tr>
    <tr class="td2"><th class="title02_3d">4</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp2[]" value="4" /></td></tr>
    <tr class="td2"><th class="title02_3d">5</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp2[]" value="5" /></td></tr>
    <tr class="td2"><th class="title02_3d">6</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp2[]" value="6" /></td></tr>
    <tr class="td2"><th class="title02_3d">7</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp2[]" value="7" /></td></tr>
    <tr class="td2"><th class="title02_3d">8</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp2[]" value="8" /></td></tr>
    <tr class="td2"><th class="title02_3d">9</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp2[]" value="9" /></td></tr>
    </tbody>
    </table>

</td>
<td>
    <table class="tblMy3D" width="100%">
    <thead>
    <tr class="td15">
    <th>号码</th>
    <th>选择</th>
    </tr>
    </thead>
    <tbody id="tbdrcmp1">
    <tr class="td2"><th class="title02_3d">0</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp1[]" value="0" /></td></tr>
    <tr class="td2"><th class="title02_3d">1</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp1[]" value="1" /></td></tr>
    <tr class="td2"><th class="title02_3d">2</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp1[]" value="2" /></td></tr>
    <tr class="td2"><th class="title02_3d">3</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp1[]" value="3" /></td></tr>
    <tr class="td2"><th class="title02_3d">4</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp1[]" value="4" /></td></tr>
    <tr class="td2"><th class="title02_3d">5</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp1[]" value="5" /></td></tr>
    <tr class="td2"><th class="title02_3d">6</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp1[]" value="6" /></td></tr>
    <tr class="td2"><th class="title02_3d">7</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp1[]" value="7" /></td></tr>
    <tr class="td2"><th class="title02_3d">8</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp1[]" value="8" /></td></tr>
    <tr class="td2"><th class="title02_3d">9</th><td class="betnum" align=center><input type="checkbox" style="display:none" name="rcmp1[]" value="9" /></td></tr>
    </tbody>
    </table>
</td>
</tr>
<tr><td colspan="4" style="background-color:#ffffff"><span id="chkmsg3"></span>
<span id="chkmsg2"></span>
<span id="chkmsg1"></span>
<span id="chkmsg"></span>

<div style="float:right">
金额
<input type="text" value="" id="setMomney" name="setMomney" size="3" />
<input type="submit" value="确定" />
<input type="reset" value="取消" />
</div></td></tr>
</table>



</form>


</div>
<div>
{lt_table}
</div>  